{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_cjdianc/template/public/ygcsslist.css">
<style type="text/css">
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 10px 15px;border: 1px solid #e5e5e5;text-align: center;}
    .yg5_tr1>th{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li class="active"><a href="{php echo $this->createWebUrl2('dlvoucher')}">代金券管理</a></li>
    <li><a href="{php echo $this->createWebUrl2('dladdvoucher')}">添加/编辑代金券</a></li>
</ul>
<div class="main">
    
    <div class="panel panel-default ygdefault">
        <div class="panel-heading wyheader">
            代金券管理
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <th class="store_td1 col-md-2">代金券名称</th>
                        <th class="col-md-1">折扣金额</th>
                        <th class="col-md-2">开始时间</th>
                        <th class="col-md-2">结束时间</th>
                        <th class="col-md-2">说明</th>
                        <th class="col-md-2">使用范围</th>
                        <th class="col-md-2">操作</th>
                    </tr>
                     {loop $list $key $item}
                    <tr class="yg5_tr2">
                        <td><div class="type-parent"> {$item['name']}</div></td>
                        <td><div class="type-parent">{$item['preferential']}</div></td>
                        <td><div class="type-parent">{$item['start_time']}</div></td>
                        <td>{$item['end_time']}</td>
                        <td>{$item['instruction']}</td>
                        {if $item['voucher_type']==1}
                  <td>
                  <span class="label storered"> 仅限外卖使用</span>
                 
                  </td>
                   {elseif $item['voucher_type']==2}
                    <td>
                    <span class="label storeblue"> 仅限店内使用</span>              
                  </td>
                  {elseif $item['voucher_type']==3}
                    <td>
                    <span class="label label-warning">两者都可使用</span> 
                  </td>
                   {/if}
                        <td>
                            <a href="{php echo $this->createWebUrl2('dladdvoucher', array('id' => $item['id']))}" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                </span>                                
                            </a>
                            <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                                <span class="fa fa-trash-o"></span>
                                <span class="bianji">删除
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                        <!-- <a class="btn btn-warning btn-xs" href="{php echo $this->createWebUrl2('dladdvoucher', array('id' => $item['id']))}" title="编辑">改</a>&nbsp;&nbsp;<button type="button" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">删</button></td> -->
                    </tr>    
                     <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl2('dlvoucher', array('op' => 'delete', 'id' => $item['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>      
                    {/loop}  
                     {if empty($list)}
                    <tr class="yg5_tr2">
                        <td colspan="7">
                          暂无代金券
                        </td>
                    </tr>             
                    {/if}        
                </table>
            </div>
        </form>
    </div>
    {$pager}
</div>
<script type="text/javascript">
    $(function(){
        // $("#frame-4").addClass("in");
        $("#frame-4").show();
        $("#yframe-4").addClass("wyactive");
    })
</script>